package com.example.LayoutGrid;

import java.io.IOException;
import android.util.Log;
import android.view.MotionEvent;
import android.view.GestureDetector.OnGestureListener;

public class MouseGestureDetectorListener implements OnGestureListener {
	
	private MouseControl mouseControl;
	
	public MouseGestureDetectorListener(MouseControl mouseControl)
	{
		super();
		this.mouseControl=mouseControl;
	}

	@Override
	public boolean onDown(MotionEvent motionevent) {
		// TODO Auto-generated method stub
		mouseControl.sendClick((int)motionevent.getX(),(int)motionevent.getY());
		Log.d("DEBUG","onDown");
		return true;
	}

	@Override
	public boolean onFling(MotionEvent motionevent, MotionEvent motionevent1,
			float f, float f1) {
		// TODO Auto-generated method stub
		Log.d("DEBUG","onFling");
		return true;
	}

	@Override
	public void onLongPress(MotionEvent motionevent) {
		// TODO Auto-generated method stub
		Log.d("DEBUG","onLongPress");

	}

	@Override
	public boolean onScroll(MotionEvent motionevent, MotionEvent motionevent1,
			float f, float f1) {
		// TODO Auto-generated method stub
		try {
			mouseControl.setPos((int)f, (int)f1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Log.d("DEBUG","monScroll");
		return false;
	}

	@Override
	public void onShowPress(MotionEvent motionevent) {
		// TODO Auto-generated method stub
		Log.d("DEBUG","onShowPress");
	}

	@Override
	public boolean onSingleTapUp(MotionEvent motionevent) {
		// TODO Auto-generated method stub
		Log.d("DEBUG","onSingleTapUp");
		return true;
	}
	

}
